1. Field of the Invention
The present invention relates to a curve interpolation method for obtaining a smooth curve based on data of a sequence of command points and performing interpolation on the smooth curve in machining a workpiece along a curved surface using a numerical controller.
2. Description of Related Art
In machining a workpiece along a curved surface of an object such as a mold by a numerical controlled machine tool, etc. according to data of a sequence of command points which are created by a CAD/CAM device or a profiler device, a curve interpolation is performed based on the data of the sequence of command points. For example, there is disclosed a method of creating an approximate spline curve based on the data of the sequence of command points and performing the curve interpolation on the created approximate spline curve in JP 2-113305A.
In JP 10-240328A, there is described an interpolation method in which vectors of line segments between adjacent twos of command points are obtained and a modification amount for each command point is obtained such that the sum of squares of differential vectors between the obtained vectors of the line segments is the least so as to modify each command point. In this document, it is described to set an evaluation range in a sequence of the command points and create an approximate curve for successive points in the evaluation range, so that the command points are modified based on differences between the approximate curve and the respective command points in the evaluation range.
In the CAD/CAM device, a tolerance is set for a target curve created by the CAD device and a plurality of line segments are created by the CAM device within the tolerance to obtain data of end points of the respective line
xe2x80x83f(t)x=Axt3+Bxt2+Cxt+Dx
f(t)y=Ayt3+Byt2+Cyt+Dy
f(t)z=Azt3+Bzt2+Czt+Dz
Thus obtained curve Ce is shown in FIG. 20.
Then, interpolation is performed on the defined curve Ce with a unit not greater than a set unit in preparing the sequence of command points (Step S16).
In the foregoing embodiment, at the start of the procedure, all of the command points P0, P1, P2, . . . , Pnxe2x88x921, Pn are read at Step S1. Alternatively, only the necessary command points may be read and the procedure may be carried out on the read points, so that the approximate curve is successively created while reading the data of the command points to expedite the procedure.
In obtaining interpolation points, i.e. shape-defining points, respective two points are interpolated between adjacent twos of the command points in the foregoing embodiment, respective points more than two may be interpolated between adjacent twos of the command points. Further, in creating the approximate curve Cm, the shape-defining points not greater than two are selected before and after the shape-defining point Qi. The shape-defining points greater than two may be selected. Furthermore, one or more of the command points P0, P1, P2, . . . , Pnxe2x88x921, Pn may be used as the shape-defining points with the interpolation points Q1, Q2, . . . , Q2n.
If a line segment connecting adjacent two of the command points P0, P1, P2, . . . , Pnxe2x88x921, Pn is shorter than a reference value, an interpolated point Pjxe2x80x2, such as a middle point between such adjacent command points Pj, Pj+1 may be regarded as a substitute command point for the adjacent command points Pj, Pj+1 which are to be deleted. In this case, it is determined whether or not a distance between the adjacent command points Pi and Pi+1 is not greater than the predetermined at Step S2, and if the distance is not greater than the predetermined value, the above procedure is performed to define a substitute command point for obtaining the interpolation points. segments as a sequence of command points to be outputted to the numerical controller.
As shown in FIG. 1, line segments L0, L1, L2, . . . are created by the CAM device within a tolerance width xe2x80x9c2wxe2x80x9d set by a tolerance amount xe2x80x9cwxe2x80x9d on both sides of an original target curve Cs which are created by the CAD device, and data of points P0, P1, P2, . . . at both ends of respective line segment L0, L1, L2, . . . are outputted to a numerical controller as data of a sequence of command points. Since a curve Ce for the curve interpolation is defined based on the position data of the sequence of command points, the curve Ce may exceed the tolerance width 2w set to the original curve Cs.
According to the method disclosed in JP10-240328A, the positions of the command points are modified but there is a possibility of creating the curve Ce same as that in FIG. 1 based on the modified command points, and it is not assured that the curve Ce is created within the tolerance width 2w set for the original curve Cs.
It is probable that the sequence of command points are positioned near ends of a band of the tolerance width 2w set to the original curve Cs. Therefore, if the curve Ce is defined based solely on the sequence of command points, the curve Ce may be positioned considerably remote from the original curve Cs. For instance, in the case where the original curve Cs is a circular arc, as shown in FIG. 2, the command points P0, P1, P2, . . . defined by the line segments L0, L1, L2, . . . within the tolerance width 2w are positioned remote from the original curve Cs by an mount approximately equal to the tolerance amount w. In this case, two points Q1 and Q2 interpolated on each of the line segments L0, L1, L2, . . . at a ratio of approximately 0.15:0.7:0.15 are positioned on the original curve Cs, as shown in FIG. 3.
The above circumstance is the same in the case where the positions of the command points are modified. For example, in the case where the original curve is a circular arc, since a sequence of command points are aligned along a circular arc, if a curve approximating the command points is created, the sequence of command points are not substantially modified. Thus, the modified sequence of command points are positioned remote form the original curve Cs by the tolerance amount w.
Since the curve Ce is defined to pass the sequence of command points P0, P1, P2, . . . , if there is an error in calculation for obtaining the sequence of command points P0, P1, P2, . . . or in approximation by a set unit in the CAD/CAM device, the error influences the definition of the curve Ce to lower machining precision and cause a vibration of the machine. Thus, the definition of the curve Ce to pass the sequence of command points may cause deterioration of the precision of the machined surface.
An object of the present invention is to provide a curve interpolation method capable of obtaining a curve approximating an original target curve within a tolerance set for the original target curve based on a sequence of command points, and performing interpolation on the obtained curve.
As describe, the command points P0, P1, P2, . . . are positioned within the tolerance width 2w and the line segments L0, L1, L2, . . . connecting the adjacent twos of the command points (P0, P1), (P1, P2), . . . are positioned within the tolerance width 2w, as shown in FIG. 5. Therefore, points Q1, Q2, Q3, . . . interpolated on the respective line segments L0, L1, L2, . . . are positioned within the tolerance width 2w. According to the present invention, a smooth curve Ce approximating an original curve Cs is defined using the interpolated points Q1, Q2, Q3, . . . , and a curve interpolation for machining a workpiece is performed on the smooth curve Ce by a procedure comprising the following steps (1)-(7).
(1) Interpolation points Q1, Q2, Q3,. . . are defined between adjacent twos of the command points (P0, P1), (P1, P2), . . . , as shape-defining points. The shape-defining points Q1, Q2, Q3, . . . are positioned inner the band of the tolerance width 2w, i.e. closer to the original curve Cs than the command points P0, P1, P2, . . . .
(2) One shape-defining point Qi and adjacent shape-defining points in front of and in the rear of the one shape-defining point Qi to be surrounded by these adjacent points are selected.
(3) A curve Cm approximating the selected shape-defining points is created, as shown in FIG. 6.
(4) The one shape-defining point Qi is moved towards the approximate curve Cm to define the modified command point Qixe2x80x2.
(5) Repeatedly executing the above steps (2)-(4) successively on the other shape-defining points to obtain the modified shape-defining points Q1xe2x80x2, Q2xe2x80x2, Q3xe2x80x2, . . . .
(6) A curve Ce passing the modified command points Q0xe2x80x2, Q1xe2x80x2, Q2xe2x80x2, . . . is defined.
(7) The interpolation is performed on the obtained curve Ce.
In the step (1), one or more of the command points P0, P1, P2, . . . may be used as the shape-defining points in addition to the interpolated points Q1, Q2, Q3, . . . . In this step (1), the interpolation points Q1, Q2, Q3, . . . are created with a unit not greater than a set unit in preparing the sequence of command points P0, P1, P2, . . .
In the step (1), if a distance between adjacent two of the command points Pj, Pj+1 is shorter than a first reference value, an interpolation point Pjxe2x80x2 between the adjacent two command points Pj, Pj+1 is used as a substitute therefor, as shown in FIG. 7. The interpolated point may be a middle point of the adjacent two command points Pj, Pj+1.
In the step (3), the approximate curve Cm may be created to have the least sum of squares of distances from the selected shape-defining points.
In the step (4), an amount of moving the one shape-defining point Qi for modification may be restricted to a set value.
In the step (4), if a distance between adjacent two of the modified shape-defining points Qjxe2x80x2, Qj+1xe2x80x2 is shorter than a second reference value, an interpolation point Qjxe2x80x3 between the adjacent two modified shape-defining points Qjxe2x80x2, Qj+1xe2x80x2 is used as a substitute for the two modified shape-defining points, as shown in FIG. 8. The interpolated point Qjxe2x80x3 may be a middle point of the adjacent two modified shape-defining points Qjxe2x80x2, Qj+1xe2x80x2.
In the step (4), the one shape defining point Qi may be moved gradually with a unit not greater than a set unit in preparing the sequence of command points P0, P1, P2, . . . .
In the step (6), first-order differentiate values Q0(1)xe2x80x2, Q1(1)xe2x80x2, Q2(1)xe2x80x2, . . . of the approximate curve Cm at points corresponding to the modified shape-defining points Q0xe2x80x2, Q1xe2x80x2, Q2xe2x80x2, . . . are used in creating the curve Ce passing a sequence of modified shape-defining points Q0xe2x80x2, Q1xe2x80x2; Q2xe2x80x2, . . . , as shown in FIG. 9.
In the step (6), the curve Ce passing the modified command points Q0xe2x80x2, Q1xe2x80x2, Q2xe2x80x2, . . . may be a NURBS curve or a spline curve.
In the step (7), the interpolation on the obtained curve Ce is performed with a unit not greater than a set unit in preparing the sequence of command points P0, P1, P2, . . . .